{% extends 'courseset-manage/courseset-layout.html.twig' %}
{% import 'macro.html.twig' as web_macro %}

{% block title %}{{ 'course.testpaper_manage'|trans }} - {{ parent() }}{% endblock %}

{% set side_nav = 'testpaper' %}
{% set parentId = parentId | default(null) %}

{% do script(['app/js/testpaper-manage/index.js']) %}

{% block main %}

  <div role="courseset-manage-testpaper">
    <div class="courseset-manage-body__title">{{ 'course.testpaper_manage.content_title'|trans }}
      <div class="courseset-manage-body__btn">
        <a href="{{ path('course_set_manage_testpaper_create',{id:courseSet.id}) }}"
          class="cd-btn cd-btn-info cd-btn-sm pull-right mls"><i class="cd-icon cd-icon-add cd-text-sm"></i>{{ 'course.testpaper_manage.create_btn'|trans }}</a>
        {{ slot('course_set.testpaper_import_btn.extension', {'courseSet': courseSet}) }}
      </div>
    </div>

    <div id="quiz-table-container">

      <table class="table table-striped table-hover" id="quiz-table">
        {{ web_macro.flash_messages() }}
        <thead>
        <tr>
          <th><input type="checkbox" autocomplete="off" data-role="batch-select"></th>
          <th width="20%">{{ 'course.testpaper_manage.name'|trans }}</th>
          <th>{{ 'course.testpaper_manage.status'|trans }}</th>
          <th>{{ 'course.testpaper_manage.statistics'|trans }}</th>
          <th>{{ 'course.testpaper_manage.time_limit'|trans }}</th>
          <th >{{ 'course.testpaper_manage.update'|trans }}</th>
          <th width="15%">{{ 'course.testpaper_manage.operation'|trans }}</th>
        </tr>
        </thead>
        <tbody>
        {% for testpaper in testpapers %}
          {% set user = users[testpaper.updatedUserId] %}
          {% include 'testpaper/manage/testpaper-list-tr.html.twig' %}
        {% else %}
          <tr>
            <td colspan="20">
              {{ 'course.testpaper_manage.empty'|trans({'%createUrl%':path('course_set_manage_testpaper_create',{id:courseSet.id})})|raw }}
            </td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
      <div>
        <label class="checkbox-inline"><input type="checkbox" autocomplete="off" data-role="batch-select"> {{'course.question_manage.select_all'|trans}}</label>
        <button class="cd-btn cd-btn-default cd-btn-sm mlm" data-role="batch-delete" data-name="{{ 'course.testpaper_manage.testpaper'|trans }}" data-url="{{ path('course_set_manage_testpaper_deletes',{courseSetId:courseSet.id}) }}">{{ 'course.testpaper_manage.delete_btn'|trans }}</button>
      </div>

      {{ web_macro.paginator(paginator) }}

      <div class="color-gray mtl">
        {{ 'course.testpaper_manage.tips'|trans({'%taskName%':setting('course.task_name')|default('admin.setting_course.task'|trans)})|raw }}
      </div>
    </div>
  </div>

{% endblock %}
